const express = require('express');

const router = express.Router();

const userInfo_handler = require('../router_handler/userInfo');

const expressJoi = require('@escook/express-joi');

const {
  update_userInfo_schema,
  update_password_schema,
  update_avatar_schema,
  update_nickname_schema,
} = require('../schema/user');

// 个人资料
router.get('/userinfo', userInfo_handler.getUserInfo);

router.post(
  '/userInfo',
  expressJoi(update_userInfo_schema),
  userInfo_handler.updateUserInfo
);

router.post(
  '/updatepwd',
  expressJoi(update_password_schema),
  userInfo_handler.updatePwd
);

router.post(
  '/update/nickname',
  expressJoi(update_nickname_schema),
  userInfo_handler.updateNickname
);

router.post(
  '/update/avatar',
  expressJoi(update_avatar_schema),
  userInfo_handler.updateAvatar
);

module.exports = router;
